package com.jsu.task;

import java.util.TimerTask;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import com.jsu.bean.CurrentMax;
import com.jsu.bean.FoundId;
import com.jsu.dao.FoundMessageMapper;
import com.jsu.service.FoundMatchToLost;
import com.jsu.service.GetFoundFaceToken;
@Component
public class FoundTask {

	@Autowired
	FoundMessageMapper foundMessageMapper;
	@Autowired
	GetFoundFaceToken getFoundFaceToken;
	@Autowired
	FoundMatchToLost foundMatchToLost;
	
	public static int pre = 0;
	
	//@Scheduled(fixedDelay = 10*1_000)
	public void run() {
		String photoBasic = "/root/find/";
		FoundId foundId = FoundId.getInstance();
		Integer id = foundMessageMapper.selectLastId();
		if(id!=null){
			System.out.println("查询到id是"+id);
			int tmp = foundId.getMaxId();
			foundId.setCurrentId(tmp);
			if(id>tmp){
				foundId.setMaxId(id);
				getFoundFaceToken.setTar(foundId, photoBasic);
				getFoundFaceToken.run();
				foundMatchToLost.setTar(foundId, photoBasic);
				foundMatchToLost.run();
			}
		}
		
	}

}
